<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
		<title></title>
	</head>
	<body>

	<div id="app">
		<button-counter v-on:clickhere='clicknow'></button-counter>
		<button-counter></button-counter>
	</div>

	<script type="text/javascript">
		
		Vue.component('button-counter',{
			data:function(){
				return {
					count:0
				}
			},
			template: `<button @click="$emit('clickhere',count++)">You click me {{count}}</button>`,
		})
		
		var vm = new Vue({
			el:'#app',
			methods:{
				clicknow : function (e) {
					console.log(e);
				}
			}
		})
	</script>
	</body>
</html>
